import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'
import Footer from '../components/footer.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      footer: Footer
    }
  },
  {
    path: '/search',
    name: 'search',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/search/index.vue')
    }
  },
  {
    path: '/searchDetail/:id',
    name: 'searchDetail',
    component: () => import(/* webpackChunkName: "about" */ '../views/searchDetail/index.vue'),
    props: true
  },
  {
    path: '/kind',
    name: 'kind',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/kind/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/kindSearch',
    name: 'kindSearch',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/kindSearch/index.vue')
    }
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/cart/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/my',
    name: 'my',
    components: {
      default: () => import(/* webpackChunkName: "about" */ '../views/my/my.vue'),
      footer: Footer
    }
  },
  {
    path: '/order',
    name: 'order',
    components: {
      default: () => import(/* webpackChunkName: "order" */ '../views/order/index.vue')
    }
  },
  {
    path: '/orderRes/:id',
    name: 'orderRes',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/orderRes/index.vue')
    },
    props: {
      default: true
    }
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    components: {
      default: () => import(/* webpackChunkName: "detail" */ '../views/detail/index.vue')
    },
    props: {
      default: true
    }
  },
  {
    path: '/collect',
    name: 'Collect',
    components: {
      default: () => import(/* webpackChunkName: "detail" */ '../views/collect/index.vue')
    }
  },
  {
    path: '/buy/:id',
    name: 'Buy',
    components: {
      default: () => import(/* webpackChunkName: "buy" */ '../views/buy/index.vue')
    },
    props: {
      default: true
    }
  },
  {
    path: '/login',
    name: 'Login',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/login/index.vue')
    }
  }, {
    path: '/register',
    name: 'Register',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/register/index.vue')
    }
  }, {
    path: '/jdregister',
    name: 'jdRegister',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/jdregister/index.vue')
    }
  }, {
    path: '/forgetPsd',
    name: 'ForgetPsd',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/forgetPsd/index.vue')
    }
  },
  {
    path: '/setUserMsg',
    name: 'SetUserMsg',
    components: {
      default: () => import(/* webpackChunkName: "home" */ '../views/setUserMsg/setUserMsg.vue')
    }
  }, {
    path: '/addressList',
    name: 'AddressList',
    components: {
      default: () => import(/* webpackChunkName: "addressList" */ '../views/address/addressList.vue')
    }
  }, {
    path: '/addAddress',
    name: 'AddAddress',
    component: () => import(/* webpackChunkName: "addAddress" */ '../views/address/addAddress.vue')
  }, {
    path: '/personal',
    name: 'Personal',
    component: () => import(/* webpackChunkName: "addAddress" */ '../views/personal/personal.vue')
  },
  {
    path: '/orderPay',
    name: 'OrderPay',
    component: () => import(/* webpackChunkName: "addAddress" */ '../views/orderPay/index.vue')
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
